import axios from "axios";

const API_URL='/api'

//我的预约
const mybookings = async(data)=>{
    const response = await axios.get(API_URL+'/booking/myBooking/'+data,{
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}

const roomBookingInfo = async(data)=>{
    const response = await axios.get(API_URL+'/timeslot/list/',{
        params:data,
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}

const addBooking = async(data)=>{
    const response = await axios.post(API_URL+'/booking/add',data,{
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}

const updateState = async(data)=>{
    const response = await axios.post(API_URL+'/booking/updateState',data,{
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}



export default{
    mybookings,
    roomBookingInfo,
    addBooking,
    updateState
}